From f7418b16527be145f6e0cef96d22b1fef14a3185 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 8 Oct 2010 10:45:24 -0400 Subject: [PATCH] Make GtkPaned use gtk_container_class_handle_border_width --- gtk/gtkpaned.c | 55 +++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index d8957e645d..ad84fadfb6 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -252,6 +252,7 @@ gtk_paned_class_init (GtkPanedClass *class) container_class->set_focus_child = gtk_paned_set_focus_child; container_class->set_child_property = gtk_paned_set_child_property; container_class->get_child_property = gtk_paned_get_child_property; + gtk_container_class_handle_border_width (container_class); paned_class->cycle_child_focus = gtk_paned_cycle_child_focus; paned_class->toggle_handle_focus = gtk_paned_toggle_handle_focus; @@ -797,7 +798,6 @@ gtk_paned_size_request (GtkWidget *widget, GtkPaned *paned = GTK_PANED (widget); GtkPanedPrivate *priv = paned->priv; GtkRequisition child_requisition; - guint border_width; requisition->width = 0; requisition->height = 0; @@ -830,10 +830,6 @@ gtk_paned_size_request (GtkWidget *widget, } } - border_width = gtk_container_get_border_width (GTK_CONTAINER (paned)); - requisition->width += border_width * 2; - requisition->height += border_width * 2; - if (priv->child1 && gtk_widget_get_visible (priv->child1) && priv->child2 && gtk_widget_get_visible (priv->child2)) { @@ -869,9 +865,6 @@ gtk_paned_size_allocate (GtkWidget *widget, GtkPaned *paned = GTK_PANED (widget); GtkPanedPrivate *priv = paned->priv; GtkAllocation widget_allocation; - guint border_width; - - border_width = gtk_container_get_border_width (GTK_CONTAINER (paned)); gtk_widget_set_allocation (widget, allocation); @@ -898,24 +891,22 @@ gtk_paned_size_allocate (GtkWidget *widget, if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { gtk_paned_calc_position (paned, - MAX (1, widget_allocation.width - - handle_size - - 2 * border_width), + MAX (1, widget_allocation.width- handle_size), child1_requisition.width, child2_requisition.width); - priv->handle_pos.x = widget_allocation.x + priv->child1_size + border_width; - priv->handle_pos.y = widget_allocation.y + border_width; + priv->handle_pos.x = widget_allocation.x + priv->child1_size; + priv->handle_pos.y = widget_allocation.y; priv->handle_pos.width = handle_size; - priv->handle_pos.height = MAX (1, widget_allocation.height - 2 * border_width); + priv->handle_pos.height = widget_allocation.height; - child1_allocation.height = child2_allocation.height = MAX (1, (gint) allocation->height - border_width * 2); + child1_allocation.height = child2_allocation.height = allocation->height; child1_allocation.width = MAX (1, priv->child1_size); - child1_allocation.x = widget_allocation.x + border_width; - child1_allocation.y = child2_allocation.y = widget_allocation.y + border_width; + child1_allocation.x = widget_allocation.x; + child1_allocation.y = child2_allocation.y = widget_allocation.y; child2_allocation.x = child1_allocation.x + priv->child1_size + priv->handle_pos.width; - child2_allocation.width = MAX (1, widget_allocation.x + widget_allocation.width - child2_allocation.x - border_width); + child2_allocation.width = MAX (1, widget_allocation.x + widget_allocation.width - child2_allocation.x); if (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL) { @@ -927,24 +918,22 @@ gtk_paned_size_allocate (GtkWidget *widget, else { gtk_paned_calc_position (paned, - MAX (1, widget_allocation.height - - handle_size - - 2 * border_width), + MAX (1, widget_allocation.height - handle_size), child1_requisition.height, child2_requisition.height); - priv->handle_pos.x = widget_allocation.x + border_width; - priv->handle_pos.y = widget_allocation.y + priv->child1_size + border_width; - priv->handle_pos.width = MAX (1, (gint) widget_allocation.width - 2 * border_width); + priv->handle_pos.x = widget_allocation.x; + priv->handle_pos.y = widget_allocation.y + priv->child1_size; + priv->handle_pos.width = widget_allocation.width; priv->handle_pos.height = handle_size; - child1_allocation.width = child2_allocation.width = MAX (1, (gint) allocation->width - border_width * 2); + child1_allocation.width = child2_allocation.width = allocation->width; child1_allocation.height = MAX (1, priv->child1_size); - child1_allocation.x = child2_allocation.x = widget_allocation.x + border_width; - child1_allocation.y = widget_allocation.y + border_width; + child1_allocation.x = child2_allocation.x = widget_allocation.x; + child1_allocation.y = widget_allocation.y; child2_allocation.y = child1_allocation.y + priv->child1_size + priv->handle_pos.height; - child2_allocation.height = MAX (1, widget_allocation.y + widget_allocation.height - child2_allocation.y - border_width); + child2_allocation.height = MAX (1, widget_allocation.y + widget_allocation.height - child2_allocation.y); } if (gtk_widget_get_mapped (widget) && @@ -1017,10 +1006,10 @@ gtk_paned_size_allocate (GtkWidget *widget, gtk_widget_get_allocation (widget, &widget_allocation); - child_allocation.x = widget_allocation.x + border_width; - child_allocation.y = widget_allocation.y + border_width; - child_allocation.width = MAX (1, allocation->width - 2 * border_width); - child_allocation.height = MAX (1, allocation->height - 2 * border_width); + child_allocation.x = widget_allocation.x; + child_allocation.y = widget_allocation.y; + child_allocation.width = allocation->width; + child_allocation.height = allocation->height; if (priv->child1 && gtk_widget_get_visible (priv->child1)) gtk_widget_size_allocate (priv->child1, &child_allocation); @@ -1206,8 +1195,6 @@ update_drag (GtkPaned *paned) size = pos; } - size -= gtk_container_get_border_width (GTK_CONTAINER (paned)); - size = CLAMP (size, priv->min_position, priv->max_position); if (size != priv->child1_size) -- 2.30.2